<template>
  <view class="config-guide-container">
    <!-- 状态栏占位 -->
    <view class="status-bar" :style="{height: statusBarHeight + 'px'}"></view>
    
    <!-- 顶部导航栏 -->
    <view class="config-navbar">
      <view class="navbar-content">
        <view class="nav-left" @click="goBack">
          <text class="back-icon">‹</text>
        </view>
        <text class="nav-title">配置向导</text>
        <view class="nav-right">
          <view class="nav-action-btn">
            <text class="action-dots">⋯</text>
          </view>
          <view class="nav-action-btn">
            <text class="action-location">📍</text>
          </view>
        </view>
      </view>
    </view>

    <!-- 内容区域 -->
    <view class="content-area">
      <!-- 第一步 -->
      <view class="step-section">
        <text class="step-title">第一步</text>
        <text class="step-description">
          按下电源开机键进入主菜单，<br/>
          选择"数据传输"选项，按OK键，<br/>
          进入该选项后选择"蓝牙传输"选项，按<br/>
          OK键，此时，血糖仪内蓝牙自动开启
        </text>
      </view>

      <!-- 设备图片 -->
      <view class="device-image-section">
        <view class="device-display">
          <view class="device-frame">
            <view class="device-screen">
              <view class="screen-content">
                <view class="screen-lines">
                  <view class="line" v-for="i in 8" :key="i"></view>
                </view>
              </view>
            </view>
            <view class="device-buttons">
              <view class="button-row">
                <view class="btn"></view>
                <view class="btn"></view>
                <view class="btn"></view>
                <view class="btn"></view>
              </view>
            </view>
          </view>
        </view>
      </view>

      <!-- 第二步 -->
      <view class="step-section">
        <text class="step-title">第二步</text>
        <text class="step-description">开启接收端手机蓝牙</text>
      </view>

      <!-- 完成提示 -->
      <view class="completion-hint">
        <text class="hint-text">已完成上述操作</text>
      </view>

      <!-- 开始配对按钮 -->
      <view class="action-button">
        <view class="primary-btn" @click="startPairing">
          <text class="btn-text">开始配对</text>
        </view>
      </view>
    </view>
  </view>
</template>

<script>
export default {
  data() {
    return {
      statusBarHeight: 0,
      deviceType: ''
    }
  },
  
  onLoad(options) {
    this.getSystemInfo()
    this.deviceType = options.deviceType || 'stethoscope'
  },
  
  methods: {
    getSystemInfo() {
      const systemInfo = uni.getSystemInfoSync()
      this.statusBarHeight = systemInfo.statusBarHeight || 0
    },
    
    goBack() {
      uni.navigateBack()
    },
    
    startPairing() {
      uni.navigateTo({
        url: `/pages/startPairing/index?deviceType=${this.deviceType}`
      })
    }
  }
}
</script>

<style lang="scss" scoped>
.config-guide-container {
  min-height: 100vh;
  background: #F5F5F5;
  position: relative;
}

.status-bar {
  background: #FFFFFF;
}

.config-navbar {
  background: #FFFFFF;
  height: 88rpx;
  border-bottom: 1px solid #E5E5E5;
  
  .navbar-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 100%;
    padding: 0 32rpx;
    
    .nav-left {
      width: 60rpx;
      height: 60rpx;
      display: flex;
      align-items: center;
      justify-content: center;
      
      .back-icon {
        font-size: 48rpx;
        color: #333333;
        font-weight: bold;
      }
    }
    
    .nav-title {
      font-size: 36rpx;
      font-weight: bold;
      color: #333333;
    }
    
    .nav-right {
      display: flex;
      align-items: center;
      
      .nav-action-btn {
        width: 60rpx;
        height: 60rpx;
        background: rgba(0, 0, 0, 0.05);
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        margin-left: 16rpx;
        
        .action-dots, .action-location {
          font-size: 24rpx;
          color: #666666;
        }
      }
    }
  }
}

.content-area {
  padding: 32rpx;
}

.step-section {
  margin-bottom: 40rpx;
  
  .step-title {
    font-size: 32rpx;
    font-weight: bold;
    color: #333333;
    display: block;
    margin-bottom: 16rpx;
  }
  
  .step-description {
    font-size: 28rpx;
    color: #666666;
    line-height: 1.6;
    display: block;
  }
}

.device-image-section {
  display: flex;
  justify-content: center;
  margin: 60rpx 0;
  
  .device-display {
    .device-frame {
      width: 300rpx;
      height: 400rpx;
      background: #4A4A4A;
      border-radius: 20rpx;
      padding: 20rpx;
      box-shadow: 0 8rpx 20rpx rgba(0, 0, 0, 0.3);
      
      .device-screen {
        width: 100%;
        height: 240rpx;
        background: #87CEEB;
        border-radius: 8rpx;
        padding: 16rpx;
        margin-bottom: 20rpx;
        
        .screen-content {
          width: 100%;
          height: 100%;
          
          .screen-lines {
            display: flex;
            flex-direction: column;
            gap: 8rpx;
            margin-top: 20rpx;
            
            .line {
              height: 4rpx;
              background: #006994;
              border-radius: 2rpx;
              
              &:nth-child(1) { width: 80%; }
              &:nth-child(2) { width: 60%; }
              &:nth-child(3) { width: 90%; }
              &:nth-child(4) { width: 40%; }
              &:nth-child(5) { width: 70%; }
              &:nth-child(6) { width: 50%; }
              &:nth-child(7) { width: 85%; }
              &:nth-child(8) { width: 35%; }
            }
          }
        }
      }
      
      .device-buttons {
        .button-row {
          display: flex;
          justify-content: space-between;
          
          .btn {
            width: 50rpx;
            height: 30rpx;
            background: #6A6A6A;
            border-radius: 6rpx;
            border: 2rpx solid #8A8A8A;
          }
        }
      }
    }
  }
}

.completion-hint {
  text-align: center;
  margin: 60rpx 0 40rpx;
  
  .hint-text {
    font-size: 28rpx;
    color: #666666;
  }
}

.action-button {
  margin-top: 60rpx;
  
  .primary-btn {
    width: 100%;
    height: 96rpx;
    background: #4ECDC4;
    border-radius: 48rpx;
    display: flex;
    align-items: center;
    justify-content: center;
    
    .btn-text {
      font-size: 32rpx;
      color: #FFFFFF;
      font-weight: 500;
    }
  }
}
</style> 